package Test;
abstract class Animal1{
    public String name;
    public int age;

    public Animal1(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public abstract void eat();
}

interface IRun{
    void run();
}
interface ISwim{
    void swim();
}
interface IFly{
    void fly();
}

class Dog1 extends Animal1 implements IRun{

    public Dog1(String name, int age) {
        super(name, age);
    }

    public void run(){
        System.out.println(this.name+"正在用两条腿走路！");
    }

    @Override
    public void eat() {
        System.out.println(this.name+"正在吃狗粮！");
    }
}

class Duck extends Animal1 implements IRun,IFly,ISwim{

    public Duck(String name, int age) {
        super(name, age);
    }

    @Override
    public void eat() {
        System.out.println(this.name+"正在吃鸭粮！");
    }

    @Override
    public void run() {
        System.out.println(this.name+"正在用两条腿扭着屁股走路！");
    }

    @Override
    public void swim() {
        System.out.println(this.name+"正在游泳！");
    }

    @Override
    public void fly() {
        System.out.println(this.name+"正在扇着翅膀飞！");
    }
}
public class Test10 {
    public static void func1(Animal1 animal1){
        animal1.eat();
    }
    public static void func2(ISwim iSwim){
        iSwim.swim();
    }
    public static void func3(IFly iFly){
        iFly.fly();
    }
    public static void func4(IRun iRun){
        iRun.run();
    }

    public static void main(String[] args) {
        func1(new Dog1("花花",10));
        func1(new Duck("丫丫",20));
        System.out.println("===============");
        func4(new Dog1("花花",10));
        func4(new Duck("丫丫",20));
        func2(new Duck("丫丫",20));
        func3(new Duck("丫丫",20));
    }
}
